package org.flexlancer.utils
{
	import org.flexlancer.Logger.Logger;
	
	public class FormatingUtils
	{
		public static function ToCurrency(parmNumber:Number):String{
			try{
				var factor_str:String = (parmNumber % 1000).toString();
				var retValue:String = "";
				var digit_required:int = 3;
				
				parmNumber = Math.floor(parmNumber / 1000);
				
				
				while ( parmNumber >= 0 ){
					
					if ( parmNumber > 0 )
						while ( factor_str.length < digit_required ) 
							factor_str = "0" + factor_str;
							
					if ( retValue != "" ) retValue = "," + retValue;
					
					retValue = factor_str + retValue;
					
					if ( parmNumber == 0 ) break;
					
					factor_str = (parmNumber % 100).toString();
					parmNumber = Math.floor(parmNumber / 100);
					
					digit_required = 2;
				}
				
				return retValue;
			}catch(err:Error){
				Logger.LogE(err);
			}
			return parmNumber.toString();
		}
		
		public static function ToFigures(parmNumber:Number):String{
			try{
				
			}catch(err:Error){
				Logger.LogE(err);
			}
			return "";
		}
	}
}